import { defineConfig } from "vite";
import path from "path";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'

export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      resolvers: [
        ElementPlusResolver(),
        IconsResolver({
          prefix: 'Icon',
        })
      ],
    }),
    Components({
      resolvers: [
        ElementPlusResolver(),
        IconsResolver({
          enabledCollections  : 'ep',
        })
      ],
    }),
    Icons({
      autoInstall: true,
    })
  ],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  server: {
    host: "0.0.0.0",
    port: 9999,
    // proxy: {
    //   "/vscode": {
    //     target: 'http:localhost:8765',
    //     changeOrigin: true,
    //     rewrite: path => path.replace(/^\/vscode/, ""),
    //   }
    // },
    // hmr: true,
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@use "@/styles/base.scss" as *;',
      },
    },
  },
});
